home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
Borland Visual dBASE Professiona v7.0
/
DATA1.CAB
/
Sample_dBASE
/
Mugs
/
Mugs.cc
< prev
next >
Wrap
Text File
|
1997-11-20
|
3KB
|
96 lines
//--------------------------------------------------------------
//
// Mugs.cc - Mugs Sample Application
//
// Custom Control Library for the Mugs application. This file
// defines comboboxes that automatically fill in values from
// the State and Supplier tables.
//
// The Customer and Supplier forms use ComboState and the
// Inventory Cart uses ComboSupplier.
//
// Dependencies: CONNECT.DMD
// SUPPLIER.DBF
// STATE.DBF
//
// Visual dBASE Samples Group
//
// $Revision: 1.8 $
//
// Copyright (c) 1997, Borland International, Inc.
// All rights reserved.
//
//---------------------------------------------------------------
CLASS COMBOSTATE(ParentObj,Name) OF COMBOBOX(ParentObj,Name) custom
with ( this )
onOpen := class::COMBOSTATE_ONOPEN
fontBold := False
style := 1
width := 5
dropDownWidth := 25
metric := 0
endwith
// {Linked Method} this.OnOpen
function COMBOSTATE_OnOpen
local dm, q, i
SET PROCEDURE TO "connect.dmd" ADDITIVE
dm = new ConnectDataModule()
q = new Query()
with ( q )
database := dm.dbMugs
sql := "select * from 'STATE.DBF'"
active := true
endwith
this.form.aState= new Array( q.rowset.count() )
i = 1
do while ( NOT q.rowset.endOfSet )
this.form.aState[i] := q.rowset.fields["State ID"].value + ;
" - " + q.rowset.fields["State"].value
q.rowset.next()
i++
enddo
q.active = false
this.form.aState.sort()
this.dataSource = "ARRAY form.aState"
return ( i )
ENDCLASS
CLASS COMBOSUPPLIER(ParentObj,Name) OF COMBOBOX(ParentObj,Name) custom
with ( this )
onOpen := class::COMBOSUPPLIER_ONOPEN
fontBold := false
fontSize := 8
style := 2
endwith
// {Linked Method} this.OnOpen
function COMBOSUPPLIER_OnOpen
local dm, q, i
SET PROCEDURE TO "connect.dmd" ADDITIVE
dm = new ConnectDataModule()
q = new Query()
with ( q )
database := dm.dbMugs
sql := "select * from 'SUPPLIER.DBF'"
active := true
endwith
this.form.aSupplier= new Array( q.rowset.count() )
i = 1
do while ( NOT q.rowset.endOfSet )
this.form.aSupplier[i] := q.rowset.fields["COMPANY"].value
q.rowset.next()
i++
enddo
q.active = false
this.form.aSupplier.sort()
this.dataSource = "ARRAY form.aSupplier"
if ( this.dataLink == "" )
this.value := this.form.aSupplier[1]
endif
return (this.value)
ENDCLASS